package com.ktkj.init.dto;

import com.ktkj.init.constant.DictConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

@ApiModel
@Data
public class DictForm {

    @ApiModelProperty(value = "父id（节点类型值为0）", example = "1")
    private Long parentId;

    @NotNull(message = "级别不能为空！")
    @ApiModelProperty(value = "级别（用于同级字典排序，默认值为1）", example = "1", required = true)
    private Integer level = DictConstant.DEFAULT_LEVEL;

    @NotBlank(message = "描述不能为空！")
    @ApiModelProperty(value = "描述", example = "中国", required = true)
    private String descs;

    @NotBlank(message = "类型不能为空！")
    @ApiModelProperty(value = "类型", example = "country", required = true)
    private String type;

    @NotBlank(message = "节点类型不能为空！")
    @ApiModelProperty(value = "节点类型(dir：目录 data：数据)", example = "dir", required = true)
    private String manageType;

    @ApiModelProperty(value = "id(修改时必须输入)", example = "1")
    private Long id;

    public DictForm() {
    }

    public DictForm(Long parentId, @NotBlank(message = "描述不能为空！") String descs, @NotBlank(message = "类型不能为空！") String type) {
        this.parentId = parentId;
        this.descs = descs;
        this.type = type;
        this.manageType = DictConstant.MANAGE_TYPE_DATA;
    }
}
